package com.tx.blog.user.controller;

import com.tx.blog.user.service.IUserService;
import com.tx.blog.user.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author tx
 * @description
 * @date  2019/4/29 14:18
 * @param  * @Param: null
 * @return 
**/
@Controller
@RequestMapping("/UserController")
public class UserRegisterController {

    @Autowired
    IUserService userService;

    @RequestMapping(value = "/registerUser",method = RequestMethod.POST)
    public ModelAndView registerUser(UserVo user){
        ModelAndView mv;
        boolean registerFlag = userService.registerUser(user);
        if(registerFlag){
            mv = new ModelAndView("login/login");
            return mv;
        }
        mv = new ModelAndView("index");
        return mv;
    }
}
